package com.ojoin.trade.common.web.dao.impl;

import com.ojoin.trade.common.web.domain.SQLAdapter;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: huanggc
 * Date: 16-6-29
 * Time: 下午4:02
 * To change this template use File | Settings | File Templates.
 */
@Component
public class SQLHelper {
    @Autowired(required = true )
    @Qualifier("sqlSession")
    protected SqlSession sqlSessionTemplate;

    private  final String BASE_SQL_NS="com.ojoin.trade.common.web.domain.Common";

    private  final String QUERY_SQL_KEY="findBySQL";


    public List query(String sql){
       return sqlSessionTemplate.selectList(BASE_SQL_NS+"."+QUERY_SQL_KEY,new SQLAdapter(sql));
    }



}
